package org.example;

public class Electronics extends Product {
    private String brand;          // 品牌
    private int warrantyPeriod;    // 保修期(月)

    public Electronics() {

    }
    public Electronics(String id, String name, double price, int quantity,
                       String brand, int warrantyPeriod) {
        super(id, name, price, quantity);
        this.brand = brand;
        this.warrantyPeriod = warrantyPeriod;
    }

    // getter 和 setter 方法
    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public int getWarrantyPeriod() {
        return warrantyPeriod;
    }

    public void setWarrantyPeriod(int warrantyPeriod) {
        this.warrantyPeriod = warrantyPeriod;
    }

    // 重写显示信息方法
    @Override
    public void result() {
        super.result();
        System.out.println("品牌: " + brand);
        System.out.println("保修期: " + warrantyPeriod + "个月");
    }
}